feat(gateway-helm-chart): add wso2.subscription.imagePullSecret#2017
Conversation
Adds a one-knob shorthand for switching the gateway helm chart from the
public GHCR images to the WSO2 private registry. Setting
`wso2.subscription.imagePullSecret` to the name of a docker-registry
Secret causes the chart to:
1. Inject that secret into every component's imagePullSecrets,
additively with the existing global and per-component lists.
2. Rewrite each component's image.repository whose value still starts
with `ghcr.io/wso2/api-platform/` to
`registry.wso2.com/wso2-api-platform/`. Explicit overrides pass
through untouched.
Credentials are intentionally not accepted in values.yaml — users create
the docker-registry Secret out-of-band, keeping subscription credentials
out of Helm release state.
Default behavior is unchanged when the field is empty.
Fixes wso2#2016
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughThis pull request adds a single values field, wso2.subscription.imagePullSecret, to the gateway Helm chart to enable optional WSO2 subscription image-pull behavior and to merge a subscription imagePullSecret into component imagePullSecrets. Key changes:
Behavior:
Additional note:
WalkthroughThis pull request implements a single 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kubernetes/helm/gateway-helm-chart/templates/_helpers.tpl`:
- Around line 71-83: The current rewrite triggers for any repository that has
the GHCR default prefix; change it to only rewrite when the repo exactly matches
the chart's component default. In the define "gateway-operator.componentImage",
compute a $componentDefault (e.g. set $componentDefault to printf "%s%s"
$defaultPrefix (trimPrefix $defaultPrefix $repo)) and replace the condition
(hasPrefix $defaultPrefix $repo) with an equality check (eq $repo
$componentDefault) while keeping the subscription check (ne $sub "") so explicit
user overrides with the same prefix are no longer rewritten.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f9a89a83-ca89-4cb9-a162-cd000c3e5253
📒 Files selected for processing (4)
kubernetes/helm/gateway-helm-chart/templates/_helpers.tplkubernetes/helm/gateway-helm-chart/templates/gateway/controller/deployment.yamlkubernetes/helm/gateway-helm-chart/templates/gateway/gateway-runtime/deployment.yamlkubernetes/helm/gateway-helm-chart/values.yaml
Previously the subscription rewrite triggered for any repository value starting with `ghcr.io/wso2/api-platform/`, which silently re-mapped explicit overrides such as SHA-pinned or canary references that happen to keep the WSO2 namespace prefix (e.g. `gateway-controller-canary`). Tighten the gate from a prefix check to an exact-default match by passing each component's canonical default repository through a new `defaultRepository` parameter on the `componentImage` helper. Rewriting now happens only when the user has not overridden `image.repository`; any explicit value — including ones still under the WSO2 GHCR namespace — passes through verbatim. Addresses CodeRabbit review feedback on wso2#2017.
Purpose
The gateway helm chart has no shorthand for switching from the public GHCR images to the WSO2 private registry. Users with a WSO2 Subscription must override every component's
image.repositoryand wire a docker-registry Secret name into both per-componentimagePullSecretsslots — three coordinated edits scattered acrossvalues.yaml.Fixes #2016
Goals
Add a single field,
wso2.subscription.imagePullSecret, that activates WSO2 subscription mode end-to-end when set: pulls authenticate againstregistry.wso2.comand default images are sourced from the WSO2 private registry.Approach
wso2.subscription.imagePullSecrettovalues.yaml(empty by default)._helpers.tpl:gateway-operator.componentImage— rewrites repositories matching the upstream prefixghcr.io/wso2/api-platform/toregistry.wso2.com/wso2-api-platform/when subscription is on. Explicit overrides (e.g.myco.internal/custom-runtime) pass through untouched.gateway-operator.componentImagePullSecretsBlock— renders theimagePullSecrets:YAML block, merging the subscription secret + global.Values.imagePullSecrets+ per-componentimagePullSecrets, additively.controller/deployment.yamlandgateway-runtime/deployment.yamlcall the helpers for theimage:line and the pull-secrets block.kubectl create secret docker-registrycommand, or sealed-secrets / external-secrets for GitOps). This keeps subscription credentials out of Helm release state.ghcr.io/wso2/api-platform/*with noimagePullSecretsblock.User stories
As a WSO2 Subscription customer deploying the gateway helm chart, I want a single field that switches images and authenticates pulls against the WSO2 private registry, so I don't have to override every
image.repositoryand wireimagePullSecretsin multiple places.Documentation
N/A —
values.yamlcarries inline usage docs for the new field, including thekubectl create secret docker-registrycommand. No external doc impact.Automation tests
Security checks
Samples
N/A — usage example is inline in
values.yaml(thekubectl create secret docker-registrycommand for creating the referenced Secret).Related PRs
N/A
Test environment
Certificate+Issuer)